package com.example.aicode.tool;

import com.example.aicode.guardrail.SafeInputGuardrail;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import reactor.core.publisher.Flux;

import java.util.List;

@InputGuardrails({SafeInputGuardrail.class})

//@AiService
public interface AiCodeService {
    @SystemMessage(fromResource = "system-prompt.txt")
    String  chat ( String userMaessage);

    @SystemMessage(fromResource = "system-prompt.txt")
    Report  chatForReport ( String userMaessage);

    record Report(String name, List<String> suggestionList){};

//    返回封装后的结果
    @SystemMessage(fromResource = "system-prompt.txt")
    Result<String> chatWithRag(String userMessage);

//    流式输出
    @SystemMessage(fromResource = "system-prompt.txt")
    Flux<String> chatStream(@MemoryId int memoryId, @UserMessage String userMessage);
}
